<template>
  <div class="head-card">
    <div class="head-card-title">{{ props.title }}</div>
    <div class="head-card-content">
      <div class="head-card-value">{{ props.cardValue }}</div>
      <div class="head-card-unit">{{ props.unit }}</div>
    </div>
    <div v-if="props.status === 'up'" class="up">{{ props.completionRate }}<img alt="" class="up-icon"
                                                                                src="@/assets/page2/up.png"></div>
    <div v-else class="balance">{{ props.completionRate }}</div>
  </div>
</template>

<script setup>

const props = defineProps({
  title: {
    type: String,
    required: true
  },
  cardValue: {
    type: [String, Number],
    required: true
  },
  unit: {
    type: String,
    default: ''
  },
  completionRate: {
    type: String,
    default: ''
  },
  status: {
    type: String,
    default: 'balance'
  }
});
</script>

<style scoped>
.head-card {
  height: 180px;
  background: #FDFEFE;
  box-shadow: 0 25px 50px 0 rgba(0, 0, 0, 0.04);
  border-radius: 8px;
}

.head-card-title {
  font-size: 20px;
  font-family: 'PingFang', serif;
  padding-left: 20px;
  padding-top: 20px;
  color: #5E6C84;
  font-weight: bold;
}

.head-card-value {
  font-family: 'PingFang', serif;
  font-size: 32px;
  color: #344563;
  letter-spacing: 0;
  font-weight: bold;
  padding-top: 20px;
  padding-left: 20px;
}

.head-card-unit {
  font-family: 'PingFang', serif;
  font-size: 20px;
  color: #344563;
  font-weight: 500;
  bottom: 0;
  text-align: center;
  padding-left: 5px;
  padding-top: 32px;
}

.head-card-content {
  display: flex;
}

.up {
  font-family: 'PingFang', serif;
  font-size: 24px;
  color: #4ECB2A;
  letter-spacing: 0;
  line-height: 16px;
  font-weight: 600;
  padding: 20px;
  text-align: right;
}

.up-icon {
  width: 20px;
  height: 20px;
  margin-left: 5px;
}

.balance {
  font-family: 'PingFang', serif;
  font-size: 24px;
  color: #3B70F6;
  letter-spacing: 0;
  line-height: 16px;
  font-weight: 600;
  padding: 20px;
  text-align: right;
}
</style>